Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made tagged_blob be able to accept constants #72

Merged
merged 3 commits into from
Jun 21, 2022

Conversation

VictorKoenders
Copy link
Contributor

@VictorKoenders VictorKoenders commented Jun 17, 2022

Description

As discussed in zulip, we want to make sure we don't have conflicting tagged-base64 tags. For this I've made espresso-systems-common

The #[tagged_blob(...)] macro did not support constants. This PR adds this, as well as a test to make sure the new derive macro actually works.


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (main)
  • Linked to GitHub issue with discussion and accepted design OR have an explanation in the PR that describes this work.
  • Wrote unit tests
  • Updated relevant documentation in the code
  • Added a relevant changelog entry to the Pending section in CHANGELOG.md
  • Re-reviewed Files changed in the GitHub PR explorer

fn test_tagged_blob_static_str() {
let a = A(Vec::new());
let str = serde_json::to_string(&a).unwrap();
assert_eq!(str, r#""A~AAAAAAAAAABr""#);
Copy link
Contributor

@alxiong alxiong Jun 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: can you help me recall why this would print to this string? Why AAAAAAAAAABr ?

cc @jbearer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe AAAAAAAAAAB is the length of the buffer (0u64) and r is the checksum

@VictorKoenders VictorKoenders merged commit 8fa27d7 into main Jun 21, 2022
@VictorKoenders VictorKoenders deleted the vko/tagged_blob_derive_consts branch June 21, 2022 16:32
@VictorKoenders VictorKoenders mentioned this pull request Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants